
<div id="sidebar">
  <ul id="sidebar-items">
<?php if (!empty($current_user)): ?>
    <li>
        <h4>欢迎登录</h4>
        <p>
            你好，<?php echo $current_user['user_name'];?>！<br />
            权限：<?php echo $current_user['roles'];?><br />
            用户组：<?php echo $current_user['group_name'];?>
        </p>
    </li>
<?php endif; ?>
    <li>
      <h3>系统菜单</h3>
      <ul class="links">
<?php if (empty($current_user)): ?>
        <li><a href="<?php echo url('default::default/index'); ?>">系统首页</a></li>
        <li><a href="<?php echo url('default::default/login'); ?>">登录</a></li>
        <li><a href="<?php echo url('default::default/register'); ?>">注册新用户</a></li>
<?php else: ?>
        <li><a href="<?php echo url('default::default/index'); ?>">系统首页</a></li>
        <li><a href="<?php echo url('default::default/changepasswd'); ?>">修改密码</a></li>
        <li><a href="<?php echo url('default::default/logout'); ?>">注销</a></li>
<?php endif; ?>
      </ul>
    </li>
<?php //dump($current_user);?>

<?php if (!empty($current_user)): ?>
    <?php
    //输出全部动作成为菜单
    // 构造查询对象
    $menu_list = Helper_Permissions::getAllPermissions();
    $menu_item = '';
    if (!empty($menu_list)){
        //dump($menu_list);
        foreach ($menu_list as $key => $value){
            $menu_item .= '<li><h2>'.$key.'</h2></li>'."\n";
            foreach ($value as $key2 => $value2 ){
                $menu_item .= '<li>'."\n";
                $menu_item .= '<h3>'.$key2.'</h3><ul class="links">'."\n";
                    foreach ($value2 as $key3 => $value3){
                        $list_url = $key.'::'.$key2.'/'.$key3;
                        //$menu_list[$value['namespace']][$value['controller']][] = $value['action'] ;
                        $menu_item .= '<li><a href="'.url($list_url).'">'.$value3['aliasname'].'</a></li>'."\n";
                    }/**/
                $menu_item .= '</ul></li>'."\n";
            }
        }
    }
    echo $menu_item;
    ?>

<?php endif; ?>







<!-- 

    <li>
      <h3>动作列表</h3>
      <ul class="links">

        <li><a href="<?php echo url('admin::permissions/index'); ?>">权限管理首页</a></li>
        <li><a href="<?php echo url('admin::permissions/list'); ?>">权限列表</a></li>
        <li><a href="<?php echo url('admin::permissions/refreshtable'); ?>">更新权限列表</a></li>

      </ul>
    </li>
    <li>
      <h3>权限管理</h3>
      <ul class="links">
        <li><a href="<?php echo url('admin::permissions/index'); ?>">权限管理首页</a></li>
        <li><a href="<?php echo url('admin::permissions/list'); ?>">权限列表</a></li>
        <li><a href="<?php echo url('admin::permissions/refreshtable'); ?>">更新权限列表</a></li>
      </ul>
    </li>
    <li>
      <h3>用户管理部分</h3>
      <ul class="links">
        <li><a href="<?php echo url('admin::default/index'); ?>">用户管理首页</a></li>
        <li><a href="<?php echo url('admin::users/add'); ?>">添加新用户</a></li>
        <li><a href="<?php echo url('admin::users/rebuild'); ?>">查看冻结用户</a></li>
        <li><a href="<?php echo url('admin::users/audit'); ?>">审核用户</a></li>
      </ul>
    </li>
    <li>
      <h3>任务系统</h3>
      <ul class="links">
        <li><a href="<?php echo url('default::tasks/pub'); ?>">公告</a></li>
        <li><a href="<?php echo url('default::tasks/index'); ?>">任务首页</a></li>
      </ul>
    </li>
    <li>
      <h3>测试用的链接</h3>
      <ul class="links">
        <li><a href="<?php echo url('admin::default/login'); ?>">admin登录</a></li>
      </ul>
    </li>


-->

  </ul>
</div>
